Skip to content

Copy subdir tup.config files during configure for scoped configs#10

Merged
typeless merged 1 commit intomainfrom
configure-subdir-configs
Feb 10, 2026
Merged

Copy subdir tup.config files during configure for scoped configs#10
typeless merged 1 commit intomainfrom
configure-subdir-configs

Conversation

@typeless
Copy link
Owner

Summary

  • Adds step 2 to putup configure: automatically copy subdir tup.config files from the config root to the build tree for out-of-tree builds
  • Enables per-component scoped configs (e.g., gmp/tup.config, mpfr/tup.config) to work seamlessly with out-of-tree variant builds
  • Removes false-positive variant detection that skipped directories containing both a Tupfile and a tup.config

Three-step configure flow

putup configure [--config X] [-B build]:
  Step 1: Install root config            (only if --config)
  Step 2: Copy source subdir tup.config  (always; no-op if in-tree)
  Step 3: Run config-generating rules    (always; no-op if none exist)

Step 2 walks the config root, finds subdir tup.config files, and copies them to corresponding locations in the build tree. This handles the gap where --config only installed the root config but subdir scoped configs had no mechanism to reach the build tree.

Changes

  • src/cli/cmd_configure.cpp — New install_source_configs helper; refactored configure_single_variant into unified three-step flow with single discover_layout call
  • src/cli/context.cpp — Removed variant-directory skip from discover_tupfile_dirs (directories with both Tupfile and tup.config are valid for scoped configs)
  • test/unit/test_e2e.cpp — 4 new E2E scenarios covering subdir config copy, scoped merge integration, in-tree no-op, and mixed static + auto-gen configs
  • docs/reference.md — Updated §3.5 configure flow documentation and CLI option descriptions

Test plan

  • All 335 existing tests pass (including 30 variant tests)
  • New test: configure copies subdir configs to build tree
  • New test: configure + subdir configs + build uses scoped merge
  • New test: configure skips copy for in-tree builds
  • New test: mixed static + auto-gen config handling

🤖 Generated with Claude Code

Configure now runs a unified three-step flow:
1. Install root config (if --config specified)
2. Copy subdir tup.config files from config root to build tree
3. Run config-generating rules (unchanged)

Step 2 enables per-component scoped configs: each subdirectory ships
a tup.config alongside its Tupfile. At configure time, these are
installed into the build tree where scoped config merging picks them
up during the build. For in-tree builds (config_root == output_root),
step 2 is a no-op.

Also removes the false-positive variant skip from discover_tupfile_dirs
that treated any directory with both Tupfile and tup.config as a variant.
Variant directories don't contain Tupfiles in normal usage.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@typeless typeless merged commit dbc6dc6 into main Feb 10, 2026
8 checks passed
@typeless typeless deleted the configure-subdir-configs branch February 10, 2026 10:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant